import { _decorator, Component, EventTouch, Graphics, Mask, Node, UITransform, v3 } from "cc";
import { back } from "./back";
const { ccclass, property } = _decorator;

@ccclass("j13")
export class j13 extends back {
  @property(Mask)
  mask: Mask;

  start() {
    const maskNode = this.mask.node;
    // const graphics = this.mask.node.getComponent(Graphics);
    const graphics = this.mask.subComp as Graphics;
    graphics.fill();
    maskNode.on(
      Node.EventType.TOUCH_MOVE,
      (event: EventTouch) => {
        const tranComp = maskNode.getComponent(UITransform);
        const uiLocation = event.getUILocation();
        const pos = tranComp.convertToNodeSpaceAR(
          v3(uiLocation.x, uiLocation.y, 0)
        );
        graphics.circle(pos.x, pos.y, 50);
        graphics.fill();
      },
      this
    );
  }

  update(deltaTime: number) {}
}
